home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / mildred.lha / lha / DeResDemo.lha / DeResTest2.ascii < prev    next >
Text File  |  1999-03-30  |  3KB  |  96 lines

  1.  
  2. WBStartup
  3. NoCli
  4.  
  5. DEFTYPE.l
  6.  
  7. .initgraphics
  8. MBitmap 0,320,240
  9. MBitmap 1,320,240
  10.  
  11. Mc2pWindow 0,320,240                ; Setup structures for c2p conversions.
  12.  
  13. InitBank 0,320*240,$10002           ; Get some free CHIP memory.
  14. CludgeBitMap 0,320,240,8,Bank(0)    ; And make it a planar bitmap.
  15. LoadBitMap 0,"DeResPic15.IFF",0        ; Get a pic
  16. MPlanar16ToBitmap 0,Bank(0)         ; Make it chunky
  17.  
  18. Dim scrtaglst.TagItem(7)            ; All this stuff sets up our
  19. scrtaglst(0)\ti_Tag = #SA_Left      ; Taglist for the screen we
  20. scrtaglst(0)\ti_Data = 0            ; want. As you can see, it's
  21. scrtaglst(1)\ti_Tag = #SA_Depth     ; rather non-standard.
  22. scrtaglst(1)\ti_Data = 8            ; it doesn't have to be, it's
  23. scrtaglst(2)\ti_Tag = #SA_Width     ; just that this routine needs
  24. scrtaglst(2)\ti_Data = 320          ; a larger screen to avoid
  25. scrtaglst(3)\ti_Tag = #SA_Height    ; clipping.
  26. scrtaglst(3)\ti_Data = 240
  27. scrtaglst(4)\ti_Tag = #SA_BitMap
  28. scrtaglst(4)\ti_Data = Addr BitMap (0)
  29. scrtaglst(5)\ti_Tag = #SA_ShowTitle
  30. scrtaglst(5)\ti_Data = 0
  31. scrtaglst(6)\ti_Tag = #SA_Draggable
  32. scrtaglst(6)\ti_Data = 0
  33. scrtaglst(7)\ti_Tag = #TAG_END      ; The most important tag of them all.
  34.  
  35.  
  36. ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
  37.  
  38. ShowPalette 0                       ; Attach our palette to the screen.
  39.  
  40. MUseBitmap 1                        ; Tell Mildred to use our main
  41.                                     ; chunky buffer (just in case)
  42. NEWTYPE.ScaleList
  43.   OpWidth.w
  44.   DestXOffset.w
  45.   SrcXOffset.q
  46.   XAddOffset.q
  47.   YAddOffset.q
  48. End NEWTYPE
  49. Dim Skale.ScaleList(240)
  50. angrad.q=Pi/180
  51. For y=0 To 239
  52.   Skale(y)\OpWidth=y+1
  53.   Skale(y)\DestXOffset=0
  54.   Skale(y)\SrcXOffset=Sin(y*angrad*2)
  55.   Skale(y)\XAddOffset=0
  56.   Skale(y)\YAddOffset=0
  57. Next y
  58.  
  59. mag.q=1
  60. its.l=0
  61. magdirection.q=1.5
  62. SourceX.q=0
  63. SourceY.q=0
  64. OpWidth.w=320
  65. OpHeight.w=240
  66. DestX.w=0
  67. DestY.w=0
  68. ResetTimer
  69. Repeat                              ; Repeat our mainloop ....
  70.   If mag+magdirection>240 OR mag+magdirection<1 Then magdirection=-magdirection
  71.   mag+magdirection
  72.   SourceXAdder.q=mag/240
  73.   SourceYAdder.q=mag/240
  74.  
  75.   ;De-Res
  76.   MZoom SourceX,SourceY,SourceXAdder,SourceYAdder,DestX,DestY,OpWidth,OpHeight,True,0,&Skale(0)
  77.  
  78.   Mc2p Bank(0)                      ; Convert our chunky buffer to
  79.   its+1
  80.  
  81. Until Joyb(0)<>0 OR Joyb(1)<>0 OR RawStatus($45)
  82. t=Timer
  83. t=Max(t,1)
  84. its=Max(its,1)
  85. a.q=50.0/(t/its)
  86. WbToScreen 1
  87. Window 2,16,16,400,60,0,"Test results",1,0
  88. WindowOutput 2
  89. NPrint a," frames per second"
  90. NPrint " "
  91. NPrint "Press mouse/joy button..."
  92. VWait 20
  93. Repeat
  94. Until Joyb(0)<>0 OR Joyb(1)<>0 OR RawStatus($45)
  95.  
  96.